import Vue from 'vue';
import VueRouter from 'vue-router';
import Home from '../views/Home.vue';

Vue.use(VueRouter);

const routes = [
  {
    path: '/login',
    name: 'login',
    component: () =>
      import(/* webpackChunkName: "Login" */ '../views/login.vue'),
  },
  {
    path: '/',
    name: 'Home',
    component: Home,
    redirect: '/home',
    children: [],
  },
  {
    path: '/home',
    name: 'home',
    component: () =>
      import(/* webpackChunkName: "home" */ '../views/gohome.vue'),
    meta: { index: 0 },
  },
  {
    path: '/search',
    name: 'search',
    component: () =>
      import(/* webpackChunkName: "search" */ '../views/search.vue'),
    meta: { index: 1 },
  },
  {
    path: '/friend',
    name: 'friend',
    component: () =>
      import(/* webpackChunkName: "friend" */ '../views/friend.vue'),
    meta: { index: 2 },
  },
  {
    path: '/setting',
    name: 'setting',
    component: () =>
      import(/* webpackChunkName: "setting" */ '../views/setting.vue'),
    meta: { index: 3 },
  },
  {
    path: '/Demo1',
    name: 'Demo1',
    component: () =>
      import(/* webpackChunkName: "Demo1" */ '../views/Demo1.vue'),
  },
];

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
});

export default router;
